package com.company;

import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;

public class prosys {
    private JTextField textField1;
    private JTextField textField2;
    private JButton 查询Button;
    private JTable table1;
    private JPanel panel1;
    private DefaultTableModel table3;
    private Object[][] data;
    private String[] total={"学号","姓名","性别","系别","寝室","班级","年级"};

    public prosys() {
        JFrame pro = new JFrame("信息查询");
        pro.setSize(400, 400);
        pro.add(panel1);
        pro.setLocation(400,250);
        pro.setVisible(true);
        查询Button.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
             String name=textField2.getText();
             ZSGC zs=new ZSGC();
                try {
                    table3.addRow(zs.chazhao(name));
                } catch (SQLException ex) {
                    ex.printStackTrace();
                }
            }
        });
    }
    public static void main(String[] args) {
        prosys pr=new prosys();
    }
    private void createUIComponents() {
        // TODO: place custom component creation code here
        data=null;
        table3=new DefaultTableModel(data,total);
        table1 = new JTable(table3);
    }
}
